/*
    manifest.me - Packaging manifest for standard files in an installable package
 */

Me.load({
    'package-manifest': {
        packages: {
            binary: {
                prefixes:   [ 'app' ],
                platforms:  [ 'windows', 'macosx' ],
            },
        },

        sets: {
            core: [
                {
                    perform: function(from, to, options) {
                        let version = makeme.generating == 'make' ? '$(VERSION)' : me.settings.version
                        if (me.globals.vapp) {
                            linkFile(version, me.globals.app.join('latest'))
                        }
                    },
                    enable:     "me.platform.like == 'unix'",
                }
            ],
            package: [
                {
                    from: [ 
                                '${TOP}/doc/contents/README.TXT', 
                                '${TOP}/installs/install.sh', 
                                '${TOP}/installs/uninstall.sh' 
                    ],
                    to:         '${media}/',
                    patch:      true,

               }, {
                    from:       '${TOP}/installs/windows/LICENSE.TXT',
                    to:         '${media}/',
                    patch:      true,
                    fold:       true,
                    enable:     "me.platform.os == 'windows'",

               }, {
                    from:       '${TOP}/doc/contents/README.TXT',
                    to:         '${app}/',
                    fold:       true,
                    patch:      true,

               }, {
                    from:       '${TOP}/installs/install.sh',
                    to:         '${abin}/install',
                    patch:      true,
                    permissions: 0755,

               }, {
                    from:       '${TOP}/installs/uninstall.sh',
                    to:         '${abin}/uninstall',
                    patch:      true,
                    permissions: 0755,

                }, {
                    from:       '${targets.compiler.crt}',
                    to:         '${abin}',
                    enable:     "me.platform.os == 'windows' && !makeme.generating",
                    permissions: 0755,

                }, {
                    from:        '${BIN}/removeFiles${EXE}',
                    to:          '${abin}/',
                    enable:      "me.platform.os == 'windows' && Path('installs/windows/removeFiles.c').exists",
                }
            ],
            pak: [
                {
                    from: [ 
                                '${TOP}/LICENSE.md', 
                                '${TOP}/README.md' 
                    ],
                    to:         '${src}/',

                }, {
                    from:       '${TOP}/installs/package.json',
                    to:         '${src}/',
                    enable:      "Path('${TOP}/installs/package.json').exists",

                }, {
                    from:       '${TOP}/package.json',
                    to:         '${src}/',
                    enable:      "!Path('${TOP}/installs/package.json').exists && Path('${TOP}/package.json').exists",
                },
            ],
        },
    },
})

